package com.tgy.clickhouse.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;

@Slf4j
public class RoutingDataSource extends AbstractRoutingDataSource {
    @Override
    protected Object determineCurrentLookupKey() {
        log.info("当前使用的数据源是{}", RoutingDataSourceContext.getDataSourceRoutingKey());
        return RoutingDataSourceContext.getDataSourceRoutingKey();
    }
}
